package cn.tianyigps.tianyigpsgatherchecker.handler;

import cn.tianyigps.tianyigpsgatherchecker.bean.Condition;
import cn.tianyigps.tianyigpsgatherchecker.bean.RuleModel;
import cn.tianyigps.tianyigpsgatherchecker.utils.TimeUtil;

import java.util.Date;

public class CheckRule {
    public static Boolean ruleCheck(RuleModel<Condition> ruleModel, Date reportTime) {
        if (TimeUtil.checkDate(ruleModel.getBegin_date(), ruleModel.getEnd_date(), reportTime))
            return false;

        if (!TimeUtil.belongCalendar(reportTime, ruleModel.getBegin_time(), ruleModel.getEnd_time()))
            return false;

        return true;
    }
}


